home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 597 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  746 b 

  1. Path: vax.sbu.ac.uk!tonyh
  2. From: tonyh@vax.sbu.ac.uk
  3. Newsgroups: comp.lang.c++
  4. Subject: Using ARGV on VAX - How?
  5. Date: 5 Jan 96 09:49:56 GMT
  6. Organization: South Bank University
  7. Message-ID: <1996Jan5.094956.1@vax.sbu.ac.uk>
  8. NNTP-Posting-Host: vax.sbu.ac.uk
  9.  
  10. Hi out there everyone,
  11.  
  12. Just a quickie, how do i get VAX to execute the argv 
  13. command in C.
  14.  
  15. I include stdio.h and stdlib.h, the file is called myfile.c :
  16.  
  17. main (int argc, char *argv[])
  18. {
  19.     if (argv != 2) {
  20.      printf("you forgot to enter your name");
  21.     exit(1);
  22.     }
  23.     printf("Hello %s", argv[1]);
  24. }
  25.  
  26. when i type exe myfile.c  tony it should produce 'Hello Tony'
  27. but all i get is :
  28.  
  29.     "you forgot to enter your name"
  30.  
  31. can someone email me (if possible) and tell me what I'm doing wrong?
  32.  
  33.